package com.googlecode.horncomb.web.spring.tags;

import javax.servlet.jsp.JspException;

import org.springframework.util.StringUtils;

public class FormTag extends org.springframework.web.servlet.tags.form.FormTag {
	private static final long serialVersionUID = -5722290257711950793L;

	protected String resolveCommandName() throws JspException {
		Object resolvedCommmandName = evaluate("commandName", getCommandName());
		// if (resolvedCommmandName == null) {
		// throw new IllegalArgumentException("'commandName' must not be null");
		// }
		return (String) resolvedCommmandName;
	}

	protected String autogenerateId() throws JspException {
		String commandName = resolveCommandName();
		return StringUtils.hasText(commandName) ? commandName : "form";
	}
}
